<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>Kettle调度监控平台</title>
    <link rel="shortcut icon" th:href="@{/img/favicon.ico}" href="../static/img/favicon.ico">
    <link th:href="@{/css/bootstrap.min.css}" href="../static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link th:href="@{/css/font-awesome.min.css}" href="../static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link th:href="@{/css/animate.css}" href="../static/css/animate.css" rel="stylesheet">
    <link th:href="@{/css/style.css}" href="../static/css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
<div id="wrapper">
    <!--左侧导航开始-->
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="nav-close">
            <i class="fa fa-times-circle"></i>
        </div>
        <div class="sidebar-collapse">
            <ul class="nav" id="side-menu">
                <li class="nav-header">
                    <div class="dropdown profile-element">
                        <span><img alt="image" th:src="@{/img/logo.jpg}" src="../static/img/logo.jpg"></span>
                    </div>
                    <div class="logo-element">Data</div>
                </li>
                <li>
                    <a href="javascript:void(0)">
                        <i class="fa fa-database" aria-hidden="true"></i>
                        <span class="nav-label">资源库管理</span>
                        <span class="fa arrow"></span>
                    </a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a class="J_menuItem" th:href="@{/web/repository/list.shtml}" href="/web/repository/list.shtml">&nbsp;资源库管理</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="javascript:void(0)">
                        <i class="fa fa-calendar" aria-hidden="true"></i>
                        <span class="nav-label">定时策略</span>
                        <span class="fa arrow"></span>
                    </a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a class="J_menuItem" th:href="@{/web/quartz/list.shtml}" href="/web/quartz/list.shtml">&nbsp;定时策略</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="javascript:void(0)">
                        <i class="fa fa-television" aria-hidden="true"></i>
                        <span class="nav-label">视图管理</span>
                        <span class="fa arrow"></span>
                    </a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a class="J_menuItem" th:href="@{/web/mview/list.shtml}" href="/web/mview/list.shtml">视图列表</a>
                        </li>
                        <li>
                            <a class="J_menuItem" th:href="@{/web/trans/monitor/list.shtml}" href="/web/trans/monitor/list.shtml">&nbsp;转换监控</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="javascript:void(0)">
                        <i class="fa fa-tasks" aria-hidden="true"></i>
                        <span class="nav-label">任务管理</span>
                        <span class="fa arrow"></span>
                    </a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a class="J_menuItem" th:href="@{/web/category/list.shtml}" href="/web/category/list.shtml">&nbsp;任务分类</a>
                        </li>
                        <li>
                            <a class="J_menuItem" th:href="@{/web/job/list.shtml}" href="/web/job/list.shtml">&nbsp;作业管理</a>
                        </li>
                        <li>
                            <a class="J_menuItem" th:href="@{/web/trans/list.shtml}" href="/web/trans/list.shtml">&nbsp;转换管理</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="javascript:void(0)">
                        <i class="fa fa-desktop" aria-hidden="true"></i>
                        <span class="nav-label">监控管理</span>
                        <span class="fa arrow"></span>
                    </a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a class="J_menuItem" th:href="@{/web/job/monitor/list.shtml}" href="/web/job/monitor/list.shtml">&nbsp;作业监控</a>
                        </li>
                        <li>
                            <a class="J_menuItem" th:href="@{/web/trans/monitor/list.shtml}" href="/web/trans/monitor/list.shtml">&nbsp;转换监控</a>
                        </li>
                    </ul>
                </li>
                <li id="isAdmin">
                    <a href="javascript:void(0)">
                        <i class="fa fa-users" aria-hidden="true"></i>
                        <span class="nav-label">用户管理</span>
                        <span class="fa arrow"></span>
                    </a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a class="J_menuItem" th:href="@{/web/user/list.shtml}" href="/web/user/list.shtml">&nbsp;用户列表</a>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </nav>
    <!--左侧导航结束-->
    <!--右侧部分开始-->
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header">
                    <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="javascript:void(0)"><i class="fa fa-bars"></i></a>
                    <div class="navbar-title">Kettle调度监控平台</div>
                </div>
                <div class="navbar-user"></div>
            </nav>
        </div>
        <div class="row content-tabs">
            <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i></button>
            <nav class="page-tabs J_menuTabs">
                <div class="page-tabs-content">
                    <a th:href="@{/web/main.shtml}" href="/web/main.shtml" class="active J_menuTab" data-id="web/main.shtml">首页</a>
                </div>
            </nav>
            <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i></button>
            <div class="btn-group roll-nav roll-right">
                <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span></button>
                <ul role="menu" class="dropdown-menu dropdown-menu-right">
                    <li class="J_tabShowActive">
                        <a>定位当前选项卡</a>
                    </li>
                    <li class="divider"></li>
                    <li class="J_tabCloseAll">
                        <a>关闭全部选项卡</a>
                    </li>
                    <li class="J_tabCloseOther">
                        <a>关闭其他选项卡</a>
                    </li>
                </ul>
            </div>
            <a onclick="logout()" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
        </div>
        <div class="row J_mainContent" id="content-main">
            <iframe class="J_iframe" name="iframe0" width="100%" height="100%" th:src="@{/web/main.shtml}" src="/web/main.shtml" frameborder="0" seamless></iframe>
        </div>
        <div class="footer">
            <div class="copy-right"></div>
        </div>
    </div>
    <!--右侧部分结束-->
</div>
<!-- 全局js -->
<script th:src="@{/js/jquery.min.js}" src="../static/js/jquery.min.js?v=2.1.4"></script>
<script th:src="@{/js/bootstrap.min.js}" src="../static/js/bootstrap.min.js?v=3.3.6"></script>
<script th:src="@{/js/plugins/metisMenu/jquery.metisMenu.js}" src="../static/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script th:src="@{/js/plugins/slimscroll/jquery.slimscroll.min.js}" src="../static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script th:src="@{/js/plugins/layer/layer.min.js}" src="../static/js/plugins/layer/layer.min.js"></script>
<!-- ECharts -->
<script th:src="@{/js/plugins/echarts/echarts.js}" src="../static/js/plugins/echarts/echarts.js"></script>
<!-- 第三方插件 -->
<script type="text/javascript" th:src="@{/js/plugins/pace/pace.min.js}" src="../static/js/plugins/pace/pace.min.js"></script>
<!-- 自定义js -->
<script type="text/javascript" th:src="@{/js/hplus.js}"  src="../static/js/hplus.js?v=4.1.0"></script>
<script type="text/javascript" th:src="@{/js/contabs.js}" src="../static/js/contabs.js"></script>
<script>
$(document).ready(function () {
    // 根据用户名查询用户信息显示
    getUserInfo();
    /*判断是否为管理员*/
    isAdmin();
});

function isAdmin() {
    var username = window.localStorage.getItem("username");
    if('admin' !== username) {
        $("#isAdmin").hide();
    }
}

/*退出登录*/
function logout() {
    $.ajax({
        type: 'GET',
        async: false,
        url: '/sys/login/out.do',
        success: function (res) {
            if (!res.success) {
                alert(res.message);
            } else {
                window.localStorage.clear();
                window.location.replace("/");
            }
        },
        error: function () {
            alert("请求失败！请刷新页面重试");
        },
        dataType: 'json'
    });
}

function getUserInfo() {
    var username = window.localStorage.getItem("username");
    $.ajax({
        type: 'GET',
        async: false,
        url: '/sys/user/getUserByUsername.do?username=' + username,
        success: function (res) {
            if (!res.success) {
                alert(res.message);
            } else {
                $(".navbar-user").text('你好, ' + res.result.nickname);
                window.localStorage.setItem('userInfo', JSON.stringify(res.result));
            }
        },
        error: function () {
            alert("请求失败！请刷新页面重试");
        },
        dataType: 'json'
    });
}
</script>
</body>
</html>
